package com.spring_mvc.spring_mvc.v1.controller;

import com.spring_mvc.spring_mvc.v1.annotation.PABLO_Autowired;
import com.spring_mvc.spring_mvc.v1.annotation.PABLO_Controller;
import com.spring_mvc.spring_mvc.v1.annotation.PABLO_RequestMapping;
import com.spring_mvc.spring_mvc.v1.annotation.PABLO_RequestParam;
import com.spring_mvc.spring_mvc.v1.service.TestService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


/**
 * @Author PABLO
 * @Date 2022/5/4 15:32
 * @Desc
 */
@PABLO_Controller
@PABLO_RequestMapping("/pablo")
public class TestController {

    @PABLO_Autowired
    private TestService testService;

    @PABLO_RequestMapping("/add")
    public void add(HttpServletRequest req, HttpServletResponse resp, @PABLO_RequestParam("a") Integer a, @PABLO_RequestParam("b") Integer b) {
        try {
            resp.getWriter().write(a + "+" + b + "=" + (testService.add(a,b)));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
